using System;
using Deepcode.Flux.Core.Extensions;
using Deepcode.Flux.Core.Extensions.Codons;

namespace Deepcode.Flux.Core.Codons.SimpleCodons
{
	/// <summary>
	/// Simplest form of codon tag. Represented in the addin xml definition as
	/// Class id="id" class="the class object to create"
	/// </summary>
	[XmlCodonName("Class")]
	public class ClassCodon : AbstractCodon
	{
		public override object BuildItem(object owner, System.Collections.ArrayList subItems)
		{
			Type myType = Type.GetType( this.Class );
			object classItem = myType.GetConstructor( new System.Type[0] ).Invoke( new object[0] );
			return classItem;
		}

	}
}
